import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Item from '../Item'
import './index.less'
export default class List extends Component {
    handleSend = (moveRef)=>{
        return ()=>{
            return this.props.handleMove(moveRef)
        }
    }
    render() {
        const {todos,handleCheck} = this.props
        return (
            <ul>
                {
                    todos.map(item=>{
                        return <Item key={item.id} {...item} handleSend={this.handleSend(item.id)} handleCheck={handleCheck}/>
                    })
                }
            </ul>
        )
    }
    static propTypes = {
        handleMove:PropTypes.func.isRequired,
        handleCheck:PropTypes.func.isRequired,
        todos:PropTypes.array.isRequired
    }
}
